﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CPPEI.WebApi.Runtime
{
    class ScenarioRegInfo
    {
        public string Name { get; set; }

        public List<ActionRegInfo> Actions { get; set; }

        public ScenarioRegInfo(string name)
        {
            Name = name;
            Actions = new List<ActionRegInfo>();
        }

        public bool Exist(string actionName)
        {
            for (int index = 0; index < Actions.Count; index++)
            {
                if (string.Equals(Actions[index].Name, actionName, StringComparison.CurrentCultureIgnoreCase))
                {
                    return true;
                }
            }
            return false;
        }

        public void Add(ActionRegInfo action)
        {
            Actions.Add(action);
        }

        public ActionRegInfo Get(string actionName)
        {
            for (int index = 0; index < Actions.Count; index++)
            {
                if (string.Equals(Actions[index].Name, actionName, StringComparison.CurrentCultureIgnoreCase))
                {
                    return Actions[index];
                }
            }
            return null;
        }
    }
}
